<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="${_resources}/logo.png"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>${sessionScope.systemName}</title>
<%@ include file="/WEB-INF/jsp/kt/common/inc.jsp" %>
<script type="text/javascript">
var pwdOld='${pwdOld}';
var pwdMinLength='${pwdMinLength}';
var pwdMaxLength='${pwdMaxLength}';
var menuJson;
$(function (){
	//712 定制，密码重置首次登陆强制修改密码
	if("${customCode}" == "tianjin712suo" && "${user.initPwdTime}" != "" && "${user.userId}" != "sysadmin"){
		openEditPwdPage();
	}
	if("${customCode}" == "tianjin712suo" && "${user.userId}" == "admin"){
		getSafeLogStorageValue();
	}
	
	//获取安全日志空间告警值
	function getSafeLogStorageValue(){
		$.ajax({
	        type: "post",
	        dataType: "json",
	        url: '${_baseUrl}/SafeLogStorageAlarm/getSafeLogStorageValue',
	        data: {},
	        async : false,
	        success: function (json) {
	        	if(json.code =="1"){
	        		var rsData = JSON.parse(json.data);
	        		if(30>rsData.number){
	        			layer.alert("安全日志空间已超出告警值，请及时处理");
	        			return false;
	        		}
	        	}
	        	
	        	/* if(json.code =="0"){
	        		layer.msg(json.message);
	        	} */
	        },
			error:function(json){
				//layer.msg("系统错误,请联系管理员");
			}
	    });
	}
	
	
	// 修改密码
	function openEditPwdPage(){
		layer.open({
	        type: 2 //Page层类型
	        ,area: ['500px', '300px']
	        ,title: '修改密码'
	        ,closeBtn: 0 // 不显示关闭按钮
	        ,shade: 0.3 //遮罩透明度
	        ,maxmin: true //允许全屏最小化
	        ,anim: -1 //0-6的动画形式，-1不开启
	        ,content: '${_baseUrl}/user/passWordForceUpdate/editPwdPage?random='+Math.random(),
	         cancel: function(){
	        	layer.confirm('重置密码后强制修改密码，否则跳转登录页面', {
				    btn: ['确定','取消'],title:'提示' //按钮
				}, function(){
					window.top.location.href = "${pageContext.request.contextPath}/logout?random="+Math.random();
				},
				function(){
					layer.close();
					openEditPwdPage();
				}); 
			}
		});
	}
	$("#updatePass").hide();
	 var menuParents = '${menuParents}';
	 menuJson = eval('(' + menuParents + ')');

	var li = "<a class='navleft' onclick='showLeft()' href='javascript:;'><</a>";
	for(var i=0;i<menuJson.length;i++){
		li += "<li name='menu' class=\""+menuJson[i].classType+"\"><a id=\""+menuJson[i].menuId+"\" href=\"javascript:;\" onclick=\"skip('"+menuJson[i].menuUrl+"','"+menuJson[i].menuId+"');changeCss(this,'"+menuJson[i].classType+"')\" >"+menuJson[i].menuName+"</a></li>";
	}
	li += "<a class='navright' onclick='showRight()' href='javascript:;'>></a>";

	$("#ul").html(li);
	//默认点击第一个
	$("#ul>li:visible:nth-child(2) >a").click();
	
	navAuto();

	//提示修改密码
	if("true" == "${updateMessage}"){
		if("tianjin712suo" == "${custom}"){
			layer.msg('密码即将失效，请尽快更换平台登录密码.');
			$("#ul").hide();
			$("#ban_yue").hide();
			$("#iframeCont").hide();
			$("#update").hide();
			$("#updatePass").show(); 
		}else{
			layer.confirm('密码即将失效，请尽快更换平台登录密码。', {
				  btn: ['确定','取消'] //按钮
				}, function(index){
					layer.close(index);
					editPwdFun();
				}); 
		}
		$(".layui-layer-btn").css("text-align","center");
		$(".layui-layer-btn a").css("width","80px");
		$(".layui-layer-btn a").css("padding","0px");
		$(".layui-layer-btn a").css("font-size","14px");
		$(".layui-layer-btn a").css("border-radius","4px");
		$(".layui-layer-btn a").css("line-height","27px");
		$(".layui-layer-content").css("color","#333");
		$(".layui-layer-btn .layui-layer-btn0").css("border-color","#3979FF");
		$(".layui-layer-btn .layui-layer-btn0").css("background-color","#3979FF");
		$(".layui-layer-btn .layui-layer-btn1").css("border-color","#3979FF");
		$(".layui-layer-btn .layui-layer-btn1").css("background-color","#fff");
		$(".layui-layer-btn .layui-layer-btn1").css("color","#3979FF");
	}
	
	/* 退出 */
	$("#login_out_close_windows").click(function(){
		$.ajax({
	        type: "post",
	        dataType: "html",
	        url: '${_baseUrl}/logout/closewindows',
	        data: {},
	        success: function (data) {
	        	//关闭浏览器支持火狐
	         	var userAgent = navigator.userAgent;
				if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Chrome") !=-1) {
					window.opener = null;
					window.open("", "_self");
					window.close();
				  // window.location.href="about:blank";

				} else {
				   window.opener = null;
				   window.open("", "_self");
				   window.close();
				};
	        }
	    });
	});
});

function getWorkBeanNum(){
	$.ajax({
		type: "post",
		dataType: "json",
		url: '${_baseUrl}/myWorkbench/getWorkBeanNum',
		success: function (data) {
			if("1" == data.code){
				var banNum = data.message;
				var yueNum = data.data;
				if( banNum > 99 ){
					banNum = "99+";	
					$(".ban_tip").css("font-size","12px");
				}
				if( yueNum > 99 ){
					yueNum = "99+";	
					$(".yue_tip").css("font-size","12px");
				}
				$(".ban_tip").text(banNum);
				$(".yue_tip").text(yueNum);
			}
		},
		error:function(json){
			layer.msg("系统错误,请联系管理员");
		}
	});
}


function changeCss(evl,icon){
	var child = evl.parentNode.parentNode.childNodes;
	for(var i=0;i<child.length;i++){
		if(child[i].nodeName=="LI"){
			var classType = $(child[i]).attr("class");
			if(typeof(classType) != "undefined"){
				if(classType.indexOf("navicon_on") > 0){
					child[i].removeAttribute("class");
					classType = classType.replace("navicon_on","");
					child[i].setAttribute("class",classType+"");
				}
			}
			
		}
	}
	evl.parentNode.setAttribute("class",icon+" navicon_on");
}

/* 跳转 */
function check(){
	if($("#user").validationEngine('validate')){
		var options = {
			dataType:"json",
			success:function(json){
				if(json.code == '1'){
					layer.msg(json.message,{shift:5},function(){
						window.location.href = '${_baseUrl}/home?random='+Math.random();
					});
				}
				if(json.code == '0'){
					window.location.href='${_baseUrl}/logout?random='+Math.random();
					//layer.msg(json.message);
				}
			},
			error:function(json){
				layer.msg("系统错误,请联系管理员");
			}
		};
		$('#user').ajaxSubmit(options);
	}
}
function skip(url,menuId){
	var initwidth = document.documentElement.clientWidth;
	if(initwidth >= '1601'){
		if(url=="/workbench/showWorkbench"){
			$(".header").removeClass("header2");
			$(".header").addClass("header1");
			//$(".close2").css("display","none");
			initHeight2();
			
			}else{
				$(".header").removeClass("header1");
				$(".header").addClass("header2");
				initHeight1();
			}
		}else if(initwidth <= '1366'){
			if(url=="/workbench/showWorkbench"){
				$(".header").removeClass("header6");
				$(".header").addClass("header5");
				//$(".close2").css("display","none");
				initHeight2();
				
				}else{
					$(".header").removeClass("header5");
					$(".header").addClass("header6");
					initHeight1();
				}
		}else{
			if(url=="/workbench/showWorkbench"){
				$(".header").removeClass("header4");
				$(".header").addClass("header3");
				//$(".close2").css("display","none");
				initHeight2();
				
				}else{
					$(".header").removeClass("header3");
					$(".header").addClass("header4");
					initHeight1();
				}
		}
	var div = document.getElementById("contIframe");
	if(url.indexOf("?") > 0){
		div.src ="${_baseUrl}"+url+"&menuId="+menuId+"&random="+Math.random();
	}else{
		div.src ="${_baseUrl}"+url+"?menuId="+menuId+"&random="+Math.random();
	
	}
}

function editPwdFun(){
	layer.open({
        type: 2 //Page层类型
        ,area: ['500px', '300px']
        ,title: '修改密码'
        ,shade: 0.3 //遮罩透明度
        ,maxmin: true //允许全屏最小化
        ,anim: -1 //0-6的动画形式，-1不开启
        ,content: '${_baseUrl}/userController/editPwdPage?random='+Math.random()
	});
}


function closeAndSkip(moduleName,url,id){
	//将消息修改成已读
	$.ajax({
        type: "post",
        dataType: "json",
        url: '${_baseUrl}/index/updateMessageStatus',
        data: {messageId:id},
        success: function (data) {
        	if("1" == data.code){
        		//关闭弹出框
        		closeWin();
        		//跳转
        		skipModule(moduleName,url);
        	}else{
        		layer.msg(data.message);
        	}
        },
        error:function(json){
			layer.msg("系统错误,请联系管理员");
		}
    });
}
//跳转  跳转到上下结构
function skipModule(moduleName,url){
	//修改css样式
	$("#ul").children("li").each(function (){
		$(this).removeAttr("class");
		var a = $(this).children("a");
		if(a.html() == moduleName){
			$(this).attr("class","navicon_on");
			if("" == url){
				a.click();
			}
		}
	});
	//跳转路径
	if("" != url){
		if(url.indexOf("/workbench/showWorkbench") != -1){
			$(".ban_yue").css("display","none");
			$(".read_content_11").css("display","inline-block");
			$(".header").removeClass("header2");
			$(".header").addClass("header1");
			initHeight2();
		}else{
			/* $(".ban_yue").css("display","inline-block"); */
			$(".read_content_11").css("display","none");
			$(".header").removeClass("header1");
			$(".header").addClass("header2");
			initHeight1();
		}
		
		if(url != null && url != ""){
			var div = document.getElementById("contIframe");
			div.src = url+"&random="+Math.random();
		}	
	}
}

//跳转  跳转到上下结构
function skipModule1(moduleName,url,clickNodeId,menuId,projectId,id,projectstatus){

	//修改css样式
	$("#ul").children("li").each(function (){
		$(this).removeAttr("class");
		var a = $(this).children("a");
		if(a.html() == moduleName){
			$(this).attr("class","navicon_on");
			if("" == url){
				a.click();
			}
		}
	});
	//跳转路径
	if("" != url){
		if(url.indexOf("/workbench/showWorkbench") != -1){
			$(".ban_yue").css("display","none");
			$(".read_content_11").css("display","inline-block");
			$(".header").removeClass("header2");
			$(".header").addClass("header1");
			initHeight2();
		}else{
			/* $(".ban_yue").css("display","inline-block"); */
			$(".read_content_11").css("display","none");
			$(".header").removeClass("header1");
			$(".header").addClass("header2");
			initHeight1();
		}

		var div = document.getElementById("contIframe");

		if(url.indexOf("?") != -1){ //传过来的 url 中 存在 ？ 传值，修改url 后面参数连接符 为 &
			div.src = url+"&menuId="+menuId+"&clickNodeId="+clickNodeId+"&projectId="+projectId+"&id="+id+"&projectstatus="+projectstatus+"&random="+Math.random();
		} else {
			div.src = url+"?menuId="+menuId+"&clickNodeId="+clickNodeId+"&projectId="+projectId+"&id="+id+"&projectstatus="+projectstatus+"&random="+Math.random();
		}
	}
}
function saveReplace(){
	try{
	$(window.parent.document).contents().find("#indexIframe")[0].contentWindow.saveReplace();
	}
	catch(err){
		return;
	}		
}
function showBeforeSection(){
	try{
	$(window.parent.document).contents().find("#indexIframe")[0].contentWindow.showBeforeSection();
	}
	catch(err){
		return;
	}		
}
/* 关闭弹出框 */
function closeWin(){
	layer.closeAll();
}
/* 关闭弹出框 */
function closeWin1(layerIndex){
	layer.close(layerIndex);
}

 function needHandle(){
	layerIndex = layer.open({
        type: 2 //Page层类型
        ,area: ['700px', '600px']
        ,title: '我的工作台--待办事项'
        ,shade: 0.6 //遮罩透明度
        ,maxmin: true //允许全屏最小化
        ,anim: false //0-6的动画形式，-1不开启
        ,content: '${_baseUrl}/myWorkbench/showNeedHandleEvent?random='+Math.random()
    });
	layer.full(layerIndex);
}
 
 function needRead(){
	 layerIndex = layer.open({
	     type: 2 //Page层类型
	     ,area: ['700px', '600px']
	     ,title: '我的工作台--待阅事项'
	     ,shade: 0.6 //遮罩透明度
	     ,maxmin: true //允许全屏最小化
	     ,anim: false //0-6的动画形式，-1不开启
	     ,content: '${_baseUrl}/myWorkbench/showNeedReadEvent?random='+Math.random()
	 });
	 layer.full(layerIndex);
 }
//关闭弹框
 function onclickLastMenu(){
 
 	layer.closeAll();
 }
 /* 待办事项 */
 function showHandMessageKd(){
 	layerIndex =layer.open({
 		  type: 2, 
 		  title:'待办事项',
 		  area: ['900px', '400px'],
 		  fixed: false, //不固定
 		  maxmin: true,
 		  shim: true,
 		  content: "${_baseUrl}/index/showHandMessage?random="+Math.random(),
 		});
 	
 	layer.full(layerIndex);
 }
 /* 待阅事项 */
 function showReadMessageKd(){
 	layerIndex =layer.open({
 		  type: 2, 
 		  title:'待阅事项',
 		  area: ['900px', '400px'],
 		  fixed: false, //不固定
 		  maxmin: true,
 		  shim: true,
 		  content: "${_baseUrl}/index/showReadMessage?type=0"+"&random="+Math.random(),
 		});
 	layer.full(layerIndex);
 }
</script>
<style type="text/css">
.nav{width: 70%;margin-top: -45px;margin-left: 130px;}
.header1,.header2,.header3,.header4,.header5,.header6{background: #fff url(${_resources}/img/nav_logo_121.png) no-repeat center;height: 50px;}
.close2{right: 0px;top: -5px;width: 25px;height: 25px;}
.open2{right: -5px;}
.nav li{margin: 0px;}
.nav{padding: 0 10px;}
.fle{ display: flex; display: -webkit-flex;display: -moz-flex;display: -ms-flex; }
.between{ justify-content: space-between;-webkit-justify-content: space-between;-moz-justify-content: space-between;-ms-justify-content: space-between;}
.end{ justify-content: flex-end;-webkit-justify-content: flex-end;-moz-justify-content: flex-end;-ms-justify-content: flex-end; }
.start{ justify-content: flex-start;-webkit-justify-content: flex-start;-moz-justify-content: flex-start;-ms-justify-content: flex-start; }
.center{ justify-content: center;-webkit-justify-content: center;-moz-justify-content: center;-ms-justify-content: center; }
.nav_ban{
    color:#E88A56;
    border:1px solid #E88A56;
    width:30px;
    height:30px;
    line-height:26px;
    border-radius:15px;
    text-align: center;
    margin: 0 7px 0 0px;
}
.nav_shen{
	color: #FAE876;
	border: 1px solid #FAE876;
	width:30px;
    height:30px;
    line-height:26px;
	border-radius: 15px;
	text-align: center;
	margin: 0 7px;
}
.nav_yue{
	color:#fff;
	border:1px solid #fff;
	width:30px;
    height:30px;
    line-height:26px;
	border-radius:15px;
	text-align: center;
	margin: 0 0px 0 7px;
}
.install{
	margin-right: 30px;
}
.ban_yue > div{
	position: relative;
	cursor: pointer;
}
.ban_tip{
	position: absolute;
	right: -4px;
	top: -6px;
	background: #E88A56;
	border-radius: 43%;
	height: 18px;
	line-height: 18px;
	width: 23px;
	color: #fff;
	font-size: 13px;
	text-align: center;
}
.yue_tip{
	position: absolute;
	right: -13px;
	top: -6px;
	background: #fff;
	border-radius: 43%;
	height: 18px;
	line-height: 18px;
	width: 23px;
	color: #3979FF;
	font-size: 13px;
	text-align: center;
}

</style>
</head>
<body>
<div class='wrap' style="position: relative;">
    <div id="header" class='header' style="position: relative;">
    	<div style="height:50px;position: relative">
    		<div style="position: absolute;top: 10px;left:10px;color:#fff;font-size:18px">${sessionScope.systemName}</div>
    		<div class="ban_yue fle center" id = "ban_yue">
    			<div onclick="needHandle();" class="fle">
    				<div class="nav_ban">办</div>
    			<%--	<div class="ban_tip"></div>--%>
    			</div>
    			<div onclick="needRead();">
    				<div class="nav_yue">阅</div>
    			<%--	<div class="yue_tip"></div>--%>
    			</div>
    		</div>
    		<div class='install fr clearfix'>
	            <div id='define' class='define' href="javascript:;">
	            	${userName }
	                <div id='tag-define' class='tag'>
	                    <div class='d-box'></div>
	                    <div class='arrow'>
	                        <em></em><span></span>
	                    </div>
	                    <ul class="install_func">
	                        <li id='t-d-cancel'><a href="${_baseUrl}/logout">注销</a></li>
	                        <li id ='update'><a href="javascript:;" onClick="editPwdFun();">修改密码</a></li>
	                        <li><a id="login_out_close_windows" href="javascript:;">退出</a></li>
	                    </ul>
	                </div>
	            </div>
        	</div>
    	</div>

		<ul class="nav clearfix fle" id="ul"
		style="margin-left: 210px;position: absolute;overflow: hidden;">
	            <!--功能模块 -->
		</ul>
	        
    </div>
    <!-- 点击小图标开始  -->
	<!-- <div id="icon">
		<div id="close2" class="close2" onclick="slipHidden();initHeight1();"></div>
		<div id="open2" class="open2" onclick="slipShow();initHeight1();" style="display:none"></div>
	</div>  -->
	<!-- 点击小图标结束  -->
    <div id='iframeCont' class='iframeCont' style="overflow-y: hidden;">
        <iframe id="contIframe" name='contIframe' class='contIframe' width='100%' height='100%' frameborder="none" scrolling="auto" ></iframe>
    </div>
    <div style="margin-top: 100px" id ='updatePass' >
			  <form name="user" id="user" action="${_baseUrl}/userController/editPwd?type=1" method="post">  
					<input type="hidden" name="userId" id="userId" value='${userId}'/>
			<div class="" style="width:auto;">
				<table class="table table-bordered ofo submenu_table" style="width: 55%;height: 35%">
			  <tr>
			    <td width="20%" height="50" align="center"  ><span style="color: #f00">*</span>原密码:</td>
			    <td width="35%" valign="middle">
			    	<div class="">
			    		<input type="password" name="passwordOld" id="passwordOld" class="validate[required] nav_input">
			    	</div>
			    </td>
			  </tr>
			  <tr>
			    <td height="50" align="center"  ><span style="color: #f00">*</span>新密码:</td>
			    <td valign="middle">
			    	<div class="">
			    		<input type="password" name="password" id="password" data-prompt-position="bottomRight:-130px;" class="validate[required,minSize[${pwdMinLength }],maxSize[${pwdMaxLength }],custom[passwordRule],custom[onlyLetterNumber]] nav_input">
			    	</div>
			    </td>
			  </tr>
			  <tr>
			    <td height="50" align="center"  ><span style="color: #f00">*</span>确认密码:</td>
			    <td colspan="3" valign="top">
			    	<div class="">
			    		<input type="password" name="confirmPwd" id="confirmPwd" class="validate[required,equals[password],,custom[onlyLetterNumber]] nav_input">
			    	</div>
			    </td>
			   </tr>
			</table>
			
			</div>
			<div class="permission_an mubanclass_an ma mt20 mb10">
			    <a href="javascript:;" class="per_baocun" onClick="check();">保存</a>
			</div>
	    </form> 
    </div>
</div>
</body>
<script type='text/javascript'>	 	 
	 var  resizeTimer = null;
	 window.onresize = function(){
		   if(resizeTimer) clearTimeout(resizeTimer);
		   resizeTimer = setTimeout("navAuto();initHeight2();navStatus();setDefine();crossFold();setAuto();",100);
	 }
	 window.onload = function(){
		$("#define").mouseenter(function(){
			 $("#tag-define").css("display","block");
			 $('#t-d-cancel').trigger('click');
		});
		$("#define").mouseleave(function(){
			 $("#tag-define").css("display","none");
		});
		
		navAuto();
		initHeight2();
		navStatus();
		setDefine();
		crossFold();
		setAuto();
		/* navAdjust(); */
	 }
		// 导航栏显示隐藏
		function navAuto(){		 
			 var initWidth = document.documentElement.clientWidth;
 			 if(initWidth >= '1900'){
				 $(".nav").css({'width':'65%','margin-left':'20%'});
				 liW = 90;
			 }else{
				 $(".nav").css({'width':'56%','margin-left':'22%'});
				 liW = 85;
			 } 
			 ulW = $(".nav").width();/* 先获取屏幕分辨率 */
			 liNum = $(".nav li").length;
			 showMax = Math.floor(ulW/liW);  // 能够显示的最大li
			 hideNum=liNum-showMax;
			 if(liNum <= 5){
				 $("#ul").addClass("start");
				 $("#ul li").css('margin','0 15px');
				 $(".navleft").css('display','none');
				 $(".navright").css('display','none');
			 }else{
				 $("#ul").addClass("between");
				 $(".nav li").removeAttr('style');
				 for(var i=0;i<showMax;i++){
					 $(".nav li").eq(i).css('display','block');
				 };
				 for(var i=0;i<hideNum;i++){
					 $(".nav li").eq('-1'-i).css('display','none');
				 };
			 }
			 pointer = showMax - 1;
			 leftForbid();
			 rightForbid();
		}
	
		// 导航栏显示影藏
		function navAdjust(){
	        var winW = window.screen.width,/* 先获取屏幕分辨率 */
	                ulW = $(".nav").width()+50,/* 在获取nav的总宽度 */
	                oli = $("li[name='menu']"),/*  在获取每个li的宽度*/
	                oMR = $(".navright"),
	                oML = $(".navleft"),
	                liW = 0;
	        for(var i = 0; i<oli.length; i++){
	            liW += oli.eq(i).width();
	            if(ulW<liW){
	                oli.eq(i).css('display','none');
	            }else{
	                oli.eq(i).css('display','block');
	            }           
	        }	        
	    }
	//一级菜单：查看左边隐藏菜单
	function showLeft(){
		if(pointer-showMax >= 0){
			$("li[name='menu']").eq(pointer).css('display','none');
			$("li[name='menu']").eq(pointer-showMax).css('display','block');
			pointer = pointer - 1;
			leftForbid();
		}
	}

	function leftForbid(){
		if($(".navleft").next().css("display")=="block"){
			 $(".navleft").css('color','#999');
			 $(".navleft").css('cursor','not-allowed');
		}
		if($(".navright").prev().css("display")=="none"){
			 $(".navright").css('color','#fff');
			 $(".navright").css('cursor','pointer');
		}
	}
	//一级菜单：查看右边隐藏菜单
	function showRight(){
		var left = pointer-length;
		if(pointer - (menuJson.length - 1 ) < 0){
		pointer = pointer +1;
		$("li[name='menu']").eq(pointer).css('display','block');
		$("li[name='menu']").eq(pointer-showMax).css('display','none');	
		}
		rightForbid();
	}

	function rightForbid(){
		if($(".navright").prev().css("display")=="block"){
			 $(".navright").css('color','#999');
			 $(".navright").css('cursor','not-allowed');
		}
		if($(".navleft").next().css("display")=="none"){
			 $(".navleft").css('color','#fff');
			 $(".navleft").css('cursor','pointer');
		}
	}
	
// =============================================
	function initHeight1(){
		var topH = $('.header').height();
		if($(".header").is(":hidden")) { 
			topH=0;
		} 
		initheight = document.documentElement.clientHeight - topH,
		oCont = $('#iframeCont') ;
		oCont.height(initheight);
	};
	function initHeight2(){
		var topH = $('.header').height();
		var top1 = $('.read_content_11').height();
		
		initheight = document.documentElement.clientHeight - topH-top1,
		oCont = $('#iframeCont') ;
		oCont.height(initheight);
	};
	
	function slipHidden(){
		var oTop = document.getElementById("close2");
		var oDown = document.getElementById("open2");
		var oBox = document.getElementById("header");
		oTop.style.display = "none";
		oDown.style.display = "block";
		oBox.style.display = "none";
		var childWindow = $("#contIframe")[0].contentWindow;
		if(typeof(eval(childWindow.contIframe_a)) != 'undefined'){ 
			if(typeof(eval(childWindow.contIframe_a.initHeight3))=='function'){
				childWindow.contIframe_a.window.initHeight3();
			}else if(typeof(eval(childWindow.initHeight3))=='function'){
				childWindow.window.initHeight3();
			}
			
		}
	}
	function slipShow(){
		var oTop = document.getElementById("close2");
		var oDown = document.getElementById("open2");
		var oBox = document.getElementById("header");
		oTop.style.display = "block";
		oDown.style.display = "none";
		oBox.style.display = "block";
		var childWindow = $("#contIframe")[0].contentWindow;
		if(typeof(eval(childWindow.contIframe_a)) != 'undefined'){ 
			if(typeof(eval(childWindow.contIframe_a.initHeight4))=='function'){
				childWindow.contIframe_a.window.initHeight4();
			}else if(typeof(eval(childWindow.initHeight4))=='function'){
				childWindow.window.initHeight4();
			}
			
		}
	}
	// 导航栏样式定义
	function navStatus(){
		var oNav = $(".nav li[name='menu']"),
		    oIfr = $('.contIframe');
		//document.getElementById('icon1_a').click();
		oNav.each(function(){
			$(this).click(function(){
			    $(this).removeClass("navicon_on").addClass("navicon_on");
			    oNav.not($(this)).removeClass('navicon_on');
			});
		});
	};
	// 定义下拉菜单
	function setDefine(){
		/* var oIn = $('#define'),
		    oTag = $('#tag-define');
		oIn.mouseenter(function(){
			oTag.css('display','block');
			$('#t-d-cancel').trigger('click');
		}).mouseleave(function(){
			oTag.css('display','none');
		}); */
		$("#define").mouseenter(function(){
		    $("#tag-define").css("display","block");
		    $('#t-d-cancel').trigger('click');
		  });
		  $("#define").mouseleave(function(){
		    $("#tag-define").css("display","none");
		  });
	};

	// 横向折叠
	function crossFold(){
		var oCont = $('#cont2'),
		    oHeader = $('.header'),
		    oIframe = $('.iframeCont'),
		    oHeaderH = oHeader.height(),
		    temp=0;
		
		oCont.bind('click',function(){
			if(temp == 0){
			    oHeader.css({'overflow':'hidden'});
			    $(this).addClass('open2');
			    oIframe.animate({'height':oIframe.height()+oHeaderH});
			    oHeader.animate({'height':'0'});
			    temp = 1;
			}else if(temp == 1){
			    oHeader.css({'overflow':'visible'});
			    $(this).removeClass().addClass('close2');
			    oHeader.animate({'height':'84px'});
			    oIframe.animate({'height':oIframe.height()-oHeaderH});
			    temp = 0;
			}
		});
	}
	// 设置自适应
	function setAuto(){
		var initwidth = document.documentElement.clientWidth;
		if(initwidth >= '1680'){
			$('html').css('font-size','100%');
		}else if(initwidth >= '1025'){
			$('html').css('font-size','90%');
		}else {
			$('html').css('font-size','80%');
		}
	}
	
	
	$(function(){
        $("#todo").click(function() {       	
        layerIndex = layer.open({
                type: 2 //Page层类型
                ,area: ['700px', '400px']
                ,title: '我的工作台--待办事项'
                ,shade: 0.6 //遮罩透明度
                ,maxmin: true //允许全屏最小化
                ,anim: false //0-6的动画形式，-1不开启
                ,content: '${_baseUrl}/workbench/showNeedHandleEvent?random='+Math.random()
            });
             layer.full(layerIndex);
        });       
    })

    $(function(){
        $("#pending_items").click(function() {
       layerIndex = layer.open({
                type: 2 //Page层类型
                ,area: ['700px', '400px']
                ,title: '我的工作台--待阅事项'
                ,shade: 0.6 //遮罩透明度
                ,maxmin: true //允许全屏最小化
                ,anim: false //0-6的动画形式，-1不开启
                ,content: '${_baseUrl}/workbench/showNeedReadEvent?random='+Math.random()
            });
            layer.full(layerIndex);
        });
    }); 
function getUnreadMsg(){
    $.post("${_baseUrl}/index/getUnReadMsg",{},function(data){
    	$("#contIframe").contents().find("#handMsgCount").text(data.handleMessage);
    	$("#contIframe").contents().find("#readMsgCount").text(data.readMessage);
    },'json')
}


function needApprove(){
	layerIndex = layer.open({
		type: 2 //Page层类型
		,area: ['700px', '600px']
		,title: '我的工作台--待审事项'
		,shade: 0.6 //遮罩透明度
		,maxmin: true //允许全屏最小化
		,anim: false //0-6的动画形式，-1不开启
		,content: '${_baseUrl}/myWorkbench/showNeedApprove?random='+Math.random()
	});
	layer.full(layerIndex);
}
</script>
</html>